import java.util.*;
public class FruitDriver {


	public static void show(Fruit[] fruits) {
		System.out.printf("%-12s\t\t%-12s%n", "Name: ", "Price: ");
		for (int k = 0; k < fruits.length; k++)
			if (fruits[k].getPricePerKilogram() > 5)
				System.out.println(fruits[k]);
	}

	public static boolean findFruit(Fruit[] fruits, Fruit fSearch) {
		for (int k = 0; k < fruits.length; k++) 
			if (fruits[k].equals(fSearch)) {
				fSearch = fruits[k];
				return true;
			}

		return false;
	}


	public static void main(String[] args) {

		Scanner reader = new Scanner(System.in);

		Fruit[] fruits = new Fruit[10];
		fruits[0] = new Fruit ("Banana", 2);
		fruits[1] = new Fruit ("Apple", 4);
		fruits[2] = new Fruit ("Mango", 6);
		fruits[3] = new Fruit ("Orange", 8);
		fruits[4] = new Fruit ("Pineapple", 2);
		fruits[5] = new Fruit ("Pear", 6);
		fruits[6] = new Fruit ("Grapes", 8);
		fruits[7] = new Fruit ("Tangerine", 2);
		fruits[8] = new Fruit ("Swatermelon", 6);
		fruits[9] = new Fruit ("watermelon", 8);

		show(fruits);


		System.out.print("\n\nSnter fruito search for: ");
		Fruit fSearch = new Fruit(reader.next());


		if(findFruit(fruits, fSearch))
			System.out.println("The fruite is exists.");

		else
			System.out.println("The fruite is not exists.");





	}

}
